import config from "@renderer/config"
import http from "@renderer/utils/request"

export default {
  login: {
    url: `${config.API_URL}/u/loginByJson`,
    name: "用户登录",
    post: async function (data = {}) {
      return await http.post(this.url, data);
    },
  },

  imageCaptcha: {
    url: `${config.API_URL}/captcha/image`,
    name: "获取验证码",
    get: async function (data) {
      return await http.get(this.url, data, {
        responseType: "arraybuffer",
      });
    },
  },

  changePwd:{
    url: `${config.API_URL}/personal/updatePassword`,
    name: "修改密码",
    post: async function (data = {}) {
      return await http.post(this.url, data);
    },
  },

  updateAvatar: {
    url: `${config.API_URL}/personal/updateAvatar`,
    name: "修改头像",
    post: async function (data = {}) {
      return await http.post(this.url, data);
    }
  },

  updatePersonal:{
    url: `${config.API_URL}/personal/updatePersonal`,
    name: "修改信息",
    post: async function (data = {}) {
      return await http.post(this.url, data);
    },
  },

  logger:{
    list: {
      url: `${config.API_URL}/personal/logger/operate/page`,
      name: "操作日志",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    delete: {
      url: `${config.API_URL}/personal/logger/operate/delete`,
      name: "操作日志删除",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    empty: {
      url: `${config.API_URL}/personal/logger/operate/clean`,
      name: "操作日志清空",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    detail: {
      url: `${config.API_URL}/personal/logger/operate/get`,
      name: "操作日志详情",
      get: async function (id) {
        return await http.get(this.url + '/' + `${id}`);
      }
    }
  },
  conLog:{
    list: {
      url: `${config.API_URL}/personal/logger/login/page`,
      name: "日志列表",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    delete: {
      url: `${config.API_URL}/personal/logger/login/delete`,
      name: "日志删除",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    empty: {
      url: `${config.API_URL}/personal/logger/login/clean`,
      name: "日志清空",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    detail: {
      url: `${config.API_URL}/personal/logger/login/get`,
      name: "操作日志详情",
      get: async function (id) {
        return await http.get(this.url + '/' + `${id}`);
      }
    }
  }
}
